import React from 'react';
import { Menu, Icon, Switch } from 'antd';
const SubMenu = Menu.SubMenu;

export default class LteLeftNav extends React.Component{
  constructor(props) {
    super(props);
    this.state = {
      theme: 'dark',
      data:navBarMenuDate
    };
  };
  handleClick(e) {
    console.log('click ', e);
    this.setState({
      current: e.key
    });
  };
  render() {
	function subMenuListNode(messages){
	  var subMenuListNodeDate=messages.map(function(subMenuListdata){
		if (subMenuListdata.subMenu) {
			return (
				<SubMenu key={subMenuListdata.id} title={<span><Icon type="setting" /><span>{subMenuListdata.title}</span></span>}>
					{subMenuListNode(subMenuListdata.subMenu)}
				</SubMenu>
			);
		}
		else {
			return (
				<Menu.Item key={subMenuListdata.id}>{subMenuListdata.title}</Menu.Item>
		    );
		}
	 });
	  return subMenuListNodeDate;
	};
	return (
	      <div className="lteNav">
	        <Menu theme={this.state.theme}
	          onClick={this.handleClick}
	          style={{ width: 230 }}
	          defaultOpenKeys={['sub1']}
	          selectedKeys={[this.state.current]}
	          mode="inline">
	          		{subMenuListNode(this.state.data)}
	        </Menu>
	       </div>
	     );
    };
};


class LteLeftNav2 extends React.Component{
	render(){
		return (
			<div className="lteNav">
				
			</div>
		);
	}
};
/*const SideBarMenu=React.createClass({
	render:function(){
	    console.log(navBarMenuDate);
		return (
			<ul className="sidebar-menu">
				<SideBarList />
			</ul>
		);
	}
});*/
/*const SideBarList=React.createClass({
	render:function(){
		return (

			);
	}
});*/
var navBarMenuDate=[
	{
		id:0,
		url:"#",
		title:"评估干预",
		subMenu:[{
			id:1,
			url:"#",
			title:"新入院患者感染风险评估"
		},{
			id:2,
			url:"#",
			title:"感染患者干预"
		}]
	},
	{
		id:3,
		url:"#",
		title:"自动预警",
		subMenu:[{
			id:4,
			url:"#",
			title:"感染预警"
		},
		{
			id:5,
			url:"#",
			title:"疑似爆发预警"
		},{
			id:6,
			url:"#",
			title:"症状预警"
		}]
	},
	{
		id:7,
		url:"#",
		title:"监测调查",
		subMenu:[{
			id:8,
			url:"#",
			title:"全院综合性监测"
		},
		{
			id:9,
			url:"#",
			title:"目标性监测",
			subMenu:[{
				id:10,
				url:"#",
				title:"SSI监测"
			},{
				id:11,
				url:"#",
				title:"ICU监测"
			},{
				id:12,
				url:"#",
				title:"新生儿病房监测"
			},{
				id:13,
				url:"#",
				title:"抗菌药物检查"
			},{
				id:14,
				url:"#",
				title:"MDRO监测"
			}]
		},{
			id:15,
			url:"#",
			title:"现患率调查"
		}]
	}
	];
